import request from '@/utils/request'

//登录
export function login(userPhone,userPassword) {
  return request({
    url:'/login',
    method:'post',
    headers:{  //表单请求格式
      'Content-Type':'application/x-www-form-urlencoded'
    },
    data:{
      userPhone:userPhone,
      userPassword:userPassword
    }
  })
}

//短信登陆
export function loginByPhone(userPhone) {
  return request({
    url:'/loginByPhone',
    method:'post',
    headers:{  //表单请求格式
      'Content-Type':'application/x-www-form-urlencoded'
    },
    data:{
      userPhone:userPhone
    }
  })
}

//短信验证
export function loginByPhoneCheck(userPhone,code) {
	console.log("发起请求")
  return request({
    url:'/loginByPhoneCheck',
    method:'post',
    headers:{  //表单请求格式
      'Content-Type':'application/x-www-form-urlencoded'
    },
    data:{
      userPhone:userPhone,
	  code:code
    }
  })
}

//注册
export function register(userPhone,password,password2) {
  return request({
    url:'/register',
    method:'post',
    headers:{  //表单请求格式
      'Content-Type':'application/x-www-form-urlencoded'
    },
    data:{
      userPhone:userPhone,
      userPassword:password,
      userPassword2:password2
    }
  })
}
